package com.fr.chart.plot;

import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.chart.base.equals.Equals;
import com.fr.chart.core.glyph.Bar3DPlotGlyph;
import com.fr.chart.core.glyph.CategoryAxis3DGlyph;
import com.fr.chart.core.glyph.CategoryAxisGlyph;
import com.fr.chart.core.glyph.DateAxis3DGlyph;
import com.fr.chart.core.glyph.PlotGlyph;
import com.fr.chart.core.glyph.ValueAxis3DGlyph;
import com.fr.chart.core.glyph.ValueAxisGlyph;
import com.fr.chart.math.Plot3D;
import com.fr.chart.math.Projection;
import com.fr.data.ChartData;
import java.awt.Insets;

public class Bar3DPlot extends BarPlot
  implements Plot3D
{
  private static final long serialVersionUID = 3019714978415207642L;
  private boolean isCubic3D = true;
  private boolean isCascade = true;
  private double seriesIntervalPercent = 0.0D;
  private int deep = -1;
  private Projection projection = new Projection();
  private boolean horizontalDrawBar = false;

  public void setIsCascade(boolean paramBoolean)
  {
    this.isCascade = paramBoolean;
  }

  public boolean isCascade()
  {
    return this.isCascade;
  }

  public void setSeriesIntervalPercent(double paramDouble)
  {
    this.seriesIntervalPercent = paramDouble;
  }

  public double getSeriesIntervalPercent()
  {
    return this.seriesIntervalPercent;
  }

  public void setIsCubic3D(boolean paramBoolean)
  {
    this.isCubic3D = paramBoolean;
  }

  public boolean isCubic3D()
  {
    return this.isCubic3D;
  }

  public void setProjection(Projection paramProjection)
  {
    this.projection = paramProjection;
  }

  public Projection getProjection()
  {
    return this.projection;
  }

  public void setHorizontalDrawBar(boolean paramBoolean)
  {
    this.horizontalDrawBar = paramBoolean;
  }

  public boolean isHorizontalDrawBar()
  {
    return this.horizontalDrawBar;
  }

  public void setDeep(int paramInt)
  {
    this.deep = paramInt;
  }

  public int getDeep()
  {
    return this.deep;
  }

  public Insets createOuterIntsets()
  {
    return new Insets(10, 10, 20, 0);
  }

  public PlotGlyph createPlotGlyph(ChartData paramChartData)
  {
    Bar3DPlotGlyph localBar3DPlotGlyph = new Bar3DPlotGlyph();
    install4PlotGlyph(localBar3DPlotGlyph, paramChartData);
    installAxisGlyph(localBar3DPlotGlyph, paramChartData);
    return localBar3DPlotGlyph;
  }

  public void install4PlotGlyph(Bar3DPlotGlyph paramBar3DPlotGlyph, ChartData paramChartData)
  {
    super.install4PlotGlyph(paramBar3DPlotGlyph, paramChartData);
    paramBar3DPlotGlyph.setDeep(this.deep);
    paramBar3DPlotGlyph.setCascade(this.isCascade);
    paramBar3DPlotGlyph.setCubic3D(this.isCubic3D);
    paramBar3DPlotGlyph.setProjection(this.projection);
    paramBar3DPlotGlyph.setHorizontalDrawBar(this.horizontalDrawBar);
    paramBar3DPlotGlyph.setSeriesIntervalPercent(this.seriesIntervalPercent);
  }

  public ValueAxisGlyph createValueAxisGlyph()
  {
    return new ValueAxis3DGlyph(this.valueAxis);
  }

  public CategoryAxisGlyph createCategoryAxisGlyph()
  {
    return new CategoryAxis3DGlyph(this.categoryAxis);
  }

  public CategoryAxisGlyph createDateAxisGlyph()
  {
    return new DateAxis3DGlyph(this.categoryAxis);
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    super.readXML(paramXMLableReader);
    if (paramXMLableReader.isChildNode())
    {
      String str1 = paramXMLableReader.getTagName();
      if ("Attr3D".equals(str1))
      {
        String str2;
        if ((str2 = paramXMLableReader.getAttr("horizontalDrawBar")) != null)
          this.horizontalDrawBar = Boolean.valueOf(str2).booleanValue();
        if ((str2 = paramXMLableReader.getAttr("isCubic3D")) != null)
          setIsCubic3D(Boolean.valueOf(str2).booleanValue());
        if ((str2 = paramXMLableReader.getAttr("isCascade")) != null)
          setIsCascade(Boolean.valueOf(str2).booleanValue());
        if ((str2 = paramXMLableReader.getAttr("seriesIntervalPercent")) != null)
          setSeriesIntervalPercent(Double.valueOf(str2).doubleValue());
        if ((str2 = paramXMLableReader.getAttr("deep")) != null)
          setDeep(Integer.parseInt(str2));
      }
      else if ("Projection".equals(str1))
      {
        setProjection((Projection)paramXMLableReader.readXMLObject(new Projection()));
      }
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("Plot");
    super.writeXML(paramXMLPrintWriter);
    paramXMLPrintWriter.startTAG("Attr3D").attr("horizontalDrawBar", this.horizontalDrawBar).attr("isCubic3D", this.isCubic3D).attr("isCascade", this.isCascade).attr("seriesIntervalPercent", this.seriesIntervalPercent);
    if (this.deep != -1)
      paramXMLPrintWriter.attr("deep", this.deep);
    paramXMLPrintWriter.end();
    if (getProjection() != null)
      getProjection().writeXML(paramXMLPrintWriter);
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    Bar3DPlot localBar3DPlot = (Bar3DPlot)super.clone();
    if (this.projection != null)
      localBar3DPlot.projection = ((Projection)this.projection.clone());
    return localBar3DPlot;
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof Bar3DPlot))
      return false;
    Bar3DPlot localBar3DPlot = (Bar3DPlot)paramObject;
    if (!(super.equals(localBar3DPlot)))
      return false;
    if (localBar3DPlot.horizontalDrawBar != this.horizontalDrawBar)
      return false;
    if (localBar3DPlot.isCascade() != isCascade())
      return false;
    if (localBar3DPlot.isCubic3D() != isCubic3D())
      return false;
    if (localBar3DPlot.getDeep() != getDeep())
      return false;
    if (localBar3DPlot.getSeriesIntervalPercent() != getSeriesIntervalPercent())
      return false;
    return (Equals.equals(localBar3DPlot.getProjection(), getProjection()));
  }
}